package com.yaoweigroup.community.ui;

import com.yaoweigroup.community.R;
import com.yaoweigroup.community.config.Constant;
import com.yaoweigroup.community.interfaze.OnViewLastListener;
import com.yaoweigroup.community.util.SharePreferenceUtil;
import com.yaoweigroup.community.view.MyScrollLayout;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class WelcomeActivity extends Activity implements OnViewLastListener {

	private SharePreferenceUtil util;
	private MyScrollLayout scrollLayout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome);
		scrollLayout = (MyScrollLayout) findViewById(R.id.myScroll);
		scrollLayout.setOnViewLastListener(this);
		util = new SharePreferenceUtil(this, Constant.prf);
		boolean isFirst = util.loadBooleanSharedPreference("isFirst", true);
		if (!isFirst) {
			Intent intent = new Intent(this, MainTabActivity.class);
			startActivity(intent);
			finish();
		}

	}

	@Override
	public void slideEnd() {
		util.saveSharedPreferences("isFirst", false);
		Intent intent = new Intent(this, MainTabActivity.class);
		startActivity(intent);
		finish();
	}

}
